package com.changhong.framework.sdfs.namenode.server.datanode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author summer
 */
public class DataNodeInfo {

    private static final String VERSION_UNKNOWN = "unknown";
    private static final Logger logger = LoggerFactory.getLogger(DataNodeInfo.class);
    public static final int DEFAULT_PORT = 7001;
    private volatile String instanceId;
    private volatile String appName;
    private volatile String appGroupName;
    private volatile String ipAddr;
    private volatile int port = DEFAULT_PORT;
    private volatile String hostName;
    private volatile Boolean isCoordinatingDiscoveryServer = Boolean.FALSE;
    private volatile Map<String, String> metadata;
    private String version = VERSION_UNKNOWN;

    public DataNodeInfo() {
        this.metadata = new ConcurrentHashMap<String, String>();
    }

    public static String getVersionUnknown() {
        return VERSION_UNKNOWN;
    }

    public static Logger getLogger() {
        return logger;
    }

    public static int getDefaultPort() {
        return DEFAULT_PORT;
    }

    public String getInstanceId() {
        return instanceId;
    }

    public void setInstanceId(String instanceId) {
        this.instanceId = instanceId;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getAppGroupName() {
        return appGroupName;
    }

    public void setAppGroupName(String appGroupName) {
        this.appGroupName = appGroupName;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public Boolean getCoordinatingDiscoveryServer() {
        return isCoordinatingDiscoveryServer;
    }

    public void setCoordinatingDiscoveryServer(Boolean coordinatingDiscoveryServer) {
        isCoordinatingDiscoveryServer = coordinatingDiscoveryServer;
    }

    public Map<String, String> getMetadata() {
        return metadata;
    }

    public void setMetadata(Map<String, String> metadata) {
        this.metadata = metadata;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }
}
